var Months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var MaxDay = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

function RealTime(UtoY,UtoM,UtoD,UtoH) {

// UtoY :: 0-?  :: starting from year 0
// UtoM :: 1-7  :: utopia has only 7 Months in one year
// UtoD :: 1-24 :: there is 24 hours in a day

// RealH :: 0-23 :: Real Hour
// RealD :: 1-XX :: Real Day
// RealM :: 1-12 :: Real Month
// RealY :: YYYY :: Real Year

var RealH = 18;
var RealD = Number( Age_Start_Date.charAt(0) + Age_Start_Date.charAt(1) ); //01.34.6789
var RealM = Number( Age_Start_Date.charAt(3) + Age_Start_Date.charAt(4) );
var RealY = Number( Age_Start_Date.charAt(6) + Age_Start_Date.charAt(7) + Age_Start_Date.charAt(8) + Age_Start_Date.charAt(9) );

var Hour_Counter = (UtoY*7+UtoM-1)*24+UtoD-1; // Hours From SOA

while( Hour_Counter > 0 ){

if ( RealH < 24 ){

Hour_Counter--;
RealH ++;

if ( RealH > 23 ){

RealH = 0;
RealD ++;

if ( RealD > MaxDay[RealM-1] ){

RealD = 1;
RealM ++;

if ( RealM > 12 ){

RealM = 1;
RealY ++;

} } } }

}

var temp = "th";

if ( RealD ==  1 ) temp = "st";
if ( RealD ==  2 ) temp = "nd";
if ( RealD ==  3 ) temp = "rd";
if ( RealD == 21 ) temp = "st";
if ( RealD == 22 ) temp = "nd";
if ( RealD == 23 ) temp = "rd";
if ( RealD == 31 ) temp = "st";

RealD += temp;

if ( UtoH < 10 ) UtoH = "0" + UtoH ;

UtoD = UtoD - 1 ;

return Months[RealM-1] + " " + RealD + ", " + RealY + " (" + RealH + ":" + UtoH + " GMT)";

}


function addCommas(argNum, argThouSeparator, argDecimalPoint) {
var sThou = (argThouSeparator) ? argThouSeparator : ","
var sDec = (argDecimalPoint) ? argDecimalPoint : "."
var aParts = argNum.split(sDec)
var sInt = aParts[0] + sDec
var rTest = new RegExp("(\\d)(\\d{3}(\\" + sThou + "|\\" + sDec + "))")
while (sInt.match(rTest)) { sInt = sInt.replace(rTest, "$1" + sThou + "$2") }
aParts[0] = sInt.replace(sDec, "")
return aParts.join(sDec)
}


function Add_Commas(Number) { return addCommas( Number.toString() ); }
